package com.zhengdongzulin.zuke.app.main.mine.collection

import android.view.View
import androidx.fragment.app.Fragment
import com.zhengdongzulin.zuke.R
import com.zhengdongzulin.zuke.base.BaseActivity
import com.zhengdongzulin.zuke.base.BaseViewModel
import com.zhengdongzulin.zuke.databinding.ZkActivityCollectionFootprintBinding


/**
 * jeff
 * 我的收藏，我的足迹
 * 2021-03-27 17:50:47
 */
class ZKCollectionFootprintActivity :
    BaseActivity<BaseViewModel, ZkActivityCollectionFootprintBinding>() {

    private lateinit var mType: String
    var mTitles = arrayOf("房间", "房型")
    var mFragments = arrayListOf<Fragment>()
    override fun getLayoutResId(): Int = R.layout.zk_activity_collection_footprint

    override fun initVM(): BaseViewModel = BaseViewModel()

    override fun initView() {
        mType = intent.getStringExtra("type")!!
        when (mType) {
            "collection" -> {
                setTitleContent("我的收藏")
                mFragments.add(
                    ZKCollectionFootprintFragment.newInstance(
                        ZKCollectionFootprintFragment.CollectionFootprintType.COLLECTION_ROOM
                    )
                )
                mFragments.add(
                    ZKCollectionFootprintFragment.newInstance(
                        ZKCollectionFootprintFragment.CollectionFootprintType.COLLECTION_HOUSE_TYPE
                    )
                )
            }
            "footprint" -> {
                setTitleContent("我的足迹")
                mFragments.add(
                    ZKCollectionFootprintFragment.newInstance(
                        ZKCollectionFootprintFragment.CollectionFootprintType.FOOTPRINTN_ROOM
                    )
                )
                mFragments.add(
                    ZKCollectionFootprintFragment.newInstance(
                        ZKCollectionFootprintFragment.CollectionFootprintType.FOOTPRINT_HOUSE_TYPE
                    )
                )
            }
            "reserve" -> {
                setTitleContent("我的预约")
                mFragments.add(
                    ZKCollectionFootprintFragment.newInstance(
                        ZKCollectionFootprintFragment.CollectionFootprintType.RESERVE_ROOM
                    )
                )
                mFragments.add(
                    ZKCollectionFootprintFragment.newInstance(
                        ZKCollectionFootprintFragment.CollectionFootprintType.RESERVE_HOUSE_TYPE
                    )
                )
            }
            else -> {
                setTitleContent("我的预定")
                mView.tlTitle.visibility = View.GONE
//                mFragments.add(
//                    ZKCollectionFootprintFragment.newInstance(
//                        ZKCollectionFootprintFragment.CollectionFootprintType.RESERVE_2_ROOM
//                    )
//                )
                mFragments.add(
                    ZKCollectionFootprintFragment.newInstance(
                        ZKCollectionFootprintFragment.CollectionFootprintType.RESERVE_2_HOUSE_TYPE
                    )
                )
            }
        }

    }

    override fun initData() {
        mView.tlTitle.setViewPager(mView.vpFragment, mTitles, this, mFragments)
        mView.tlTitle.onPageSelected(0)
    }

    override fun initListener() {

    }

    override fun startObserve() {

    }

}